package keshe;


import java.sql.*;
//连接数据库类
public class DataBaseCreate {


    //连接数据库静态方法，若产生错误，则抛出相应错误信息
    public static Connection getConnection()throws SQLException,java.lang.ClassNotFoundException{
        //建立本地数据库连接，编码规则转换为utf-8(正常录入中文)
        String url="jdbc:mysql://localhost:3306/fjx?serverTimezone=UTC&characterEncoding=utf8";
        Class.forName("com.mysql.cj.jdbc.Driver");
        String userName="root";
        Connection con=DriverManager.getConnection(url, userName, "root");
        return con;
    }
}
